﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using MovieRental_Presentation.Helpers;
using System.Windows;

namespace MovieRental_Presentation.Validation
{
    public class PricePerDayValidationRule : ValidationRule
    {
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            if (value == DependencyProperty.UnsetValue)
                return new ValidationResult(false, "Invalid price.");
            bool isValid = ComponentManager.Instance.EditionComponent.VerifyPricePerDay((double)value);
            return (isValid) ? new ValidationResult(true, null) : new ValidationResult(false, "Invalid price.");
        }
    }
}
